
package br.com.danilloguimaraes.serializacao.binaria;

import br.com.danilloguimaraes.serializacao.Sedes;
import java.io.*;

/**
 *
 * @author danillo
 */
public class SedesBinario implements Sedes{

    public void write(Object value, String path) throws FileNotFoundException, IOException {
        ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(path));
        oos.writeObject(value);
        oos.close();
    }

    public Object load(String path) throws IOException, ClassNotFoundException {
        ObjectInputStream ois = new ObjectInputStream(new FileInputStream(path));
        Object value = ois.readObject();
        ois.close();
        return value;
    }
    
}
